n = int(input())
arr = input().split(" ")
best = 0
for i in range(len(arr)):
    arr[i] = int(arr[i])
    if arr[i] > best:
        best = arr[i]
for i in range(len(arr)):
    if arr[i] >= best - 10:
        print("学生%d分数为%d,等级为%s" % (i,arr[i],"A"))
    elif arr[i] >= best - 20:
        print("学生%d分数为%d,等级为%s" % (i,arr[i],"B"))
    elif arr[i] >= best - 30:
        print("学生%d分数为%d,等级为%s" % (i,arr[i],"C"))
    elif arr[i] >= best - 30:
        print("学生%d分数为%d,等级为%s" % (i,arr[i],"D"))
    else:
        print("学生%d分数为%d,等级为%s" % (i,arr[i],"F"))
